﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/Admin.master" AutoEventWireup="true" CodeFile="DonHang.aspx.cs" Inherits="Admin_DonHang" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="formBox">
    <h2>Đơn đặt hàng</h2>
    <div>
        <p>Họ tên khách hàng:<asp:TextBox ID="txtHoTen" runat="server" Width="250px"></asp:TextBox> </p>
        <p>Ngày đặt (mm/dd/yyyy)<asp:TextBox ID="txtNgayDat" runat="server" Width="250px"></asp:TextBox></p>
        <p>Trị giá:<asp:TextBox ID="txtTriGia" runat="server" Width="250px"></asp:TextBox></p>
        <p><asp:CheckBox ID="CheckBox1" runat="server" Text="Đã giao" TextAlign="Left" /></p>
        <p> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/timmm.png" Width="28px" ToolTip="Tìm khách hàng" /></p>
    </div>
    <div>
    
        <asp:GridView ID="GridDonHang" runat="server" AutoGenerateColumns="False" 
            Width="100%" DataKeyNames="DatHangID" DataSourceID="EntityDataSource1" 
            ShowFooter="True">
            <Columns>
                <asp:BoundField DataField="DatHangID" HeaderText="ID" ReadOnly="True" 
                    SortExpression="DatHangID" />
                <asp:TemplateField HeaderText="Khach hang">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Eval("KhachHang.HoTen") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="NgayDatHang" DataFormatString="{0:MM/dd/yyyy}" 
                    HeaderText="Ngày đặt" SortExpression="NgayDatHang" />
                <asp:BoundField DataField="TriGia" HeaderText="Trị giá" 
                    SortExpression="TriGia" />
                <asp:CheckBoxField DataField="DaGiao" HeaderText="Tình trạng" 
                    SortExpression="DaGiao" >
                <ItemStyle HorizontalAlign="Center" />
                </asp:CheckBoxField>
                <asp:BoundField DataField="NgayGiao" DataFormatString="{0:MM/dd/yyyy}" 
                    HeaderText="Ngày giao" SortExpression="NgayGiao" />
                <asp:BoundField DataField="PayID" HeaderText="Paypal" />
                <asp:CommandField DeleteText="Huỷ" ShowDeleteButton="True" />
                <asp:CommandField SelectText="Chọn" ShowSelectButton="True" />
            </Columns>
            <HeaderStyle CssClass="KhoiXanhLa" />
            <SelectedRowStyle BackColor="#FFCC00" />
        </asp:GridView>
        <asp:EntityDataSource ID="EntityDataSource1" runat="server" 
            ConnectionString="name=EDiamondEntities1" 
            DefaultContainerName="EDiamondEntities1" EnableFlattening="False" 
            EntitySetName="DatHangs" Include="KhachHang">
        </asp:EntityDataSource>
        <asp:QueryExtender ID="QueryExtender1" runat="server" TargetControlID="EntityDataSource1">
             <asp:SearchExpression DataFields="Khachhang.HoTen" SearchType="Contains"  ComparisonType="OrdinalIgnoreCase">
             <asp:ControlParameter DefaultValue="" ControlID="txtHoTen" PropertyName="Text" />
             </asp:SearchExpression>
             <asp:PropertyExpression>
             <asp:ControlParameter ControlID="CheckBox1" Name="DaGiao" />
        </asp:PropertyExpression>
        </asp:QueryExtender>
    </div>
    <div>
        <p style="text-align:left;padding-left:15px;"><asp:Label ID="Label2" runat="server" Font-Bold="True" Text="Chi tiết đặt hàng"></asp:Label></p>
        <asp:GridView ID="GridChiTietDH" runat="server" Width="100%" 
            AutoGenerateColumns="False" DataKeyNames="DatHangID" 
            DataSourceID="EntityDataSource2">
            <Columns>
                <asp:TemplateField HeaderText="STT"></asp:TemplateField>
                <asp:TemplateField HeaderText="Sản phẩm">
                    <ItemTemplate>
                        <asp:Label ID="Label4" runat="server" Text='<%# Eval("ThucDon.TenThucDon") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="SoLuong" HeaderText="Số lượng" 
                    SortExpression="SoLuong">
                <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:BoundField DataField="DonGia" HeaderText="Đơn giá" SortExpression="DonGia">
                <ItemStyle HorizontalAlign="Right" />
                </asp:BoundField>
                <asp:BoundField DataField="ThanhTien" HeaderText="Thành tiền" 
                    SortExpression="ThanhTien">
                <ItemStyle HorizontalAlign="Right" />
                </asp:BoundField>
            </Columns>
            <HeaderStyle CssClass="KhoiDo" />
        </asp:GridView>
        <asp:EntityDataSource ID="EntityDataSource2" runat="server" 
            ConnectionString="name=EDiamondEntities1" 
            DefaultContainerName="EDiamondEntities1" EnableFlattening="False" 
            EntitySetName="DatHangCTs" 
            Where="it.DatHangID=@id" Include="SanPham">
            <WhereParameters>
                <asp:ControlParameter ControlID="GridChiTietDH" Name="id" 
                    PropertyName="SelectedValue" Type="Int32" />
            </WhereParameters>
        </asp:EntityDataSource>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            CellPadding="4" DataKeyNames="DatHangID,SanPhamID" 
            DataSourceID="EntityDataSource3" ForeColor="#333333" GridLines="None" 
            Width="100%">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:BoundField DataField="DatHangID" HeaderText="DatHangID" ReadOnly="True" 
                    SortExpression="DatHangID" />
                <asp:BoundField DataField="SanPhamID" HeaderText="SanPhamID" ReadOnly="True" 
                    SortExpression="SanPhamID" />
                <asp:BoundField DataField="SoLuong" HeaderText="SoLuong" 
                    SortExpression="SoLuong" />
                <asp:BoundField DataField="DonGia" HeaderText="DonGia" 
                    SortExpression="DonGia" />
                <asp:BoundField DataField="ThanhTien" HeaderText="ThanhTien" 
                    SortExpression="ThanhTien" />
            </Columns>
            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
            <SortedAscendingCellStyle BackColor="#FDF5AC" />
            <SortedAscendingHeaderStyle BackColor="#4D0000" />
            <SortedDescendingCellStyle BackColor="#FCF6C0" />
            <SortedDescendingHeaderStyle BackColor="#820000" />
        </asp:GridView>
        <asp:EntityDataSource ID="EntityDataSource3" runat="server" 
            ConnectionString="name=EDiamondEntities1" 
            DefaultContainerName="EDiamondEntities1" EnableFlattening="False" 
            EntitySetName="DatHangCTs">
        </asp:EntityDataSource>
    </div>
</div>
</asp:Content>

